﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using FarseerPhysics;

namespace RacePlatformer.Support
{
    /// <summary>
    /// The HUD class, it handles the drawing of the hud and the components of it.
    /// </summary>
    public class HUD
    {
        private SpriteFont textFont;
        private Texture2D portrait;
        private MainGame maingame;
        public int candyCount = 0;
        public int maxCandy = 4;
        public Boolean hudEnabled = false;
        public HUD(MainGame maingame)
        {
            this.maingame = maingame;
            LoadContent();
        }
        public void Update(GameTime gametime)
        {
            if(hudEnabled)
            maingame.topLeftOfScreen = new Vector2(maingame.camera.Position.X - (MainGame.SCREEN_WIDTH / 2), maingame.camera.Position.Y - (MainGame.SCREEN_HEIGHT / 2));
        }
        public void draw(GameTime gametime, SpriteBatch batch)
        {
            if (hudEnabled)
            batch.DrawString(textFont,candyCount+"/"+maxCandy + " Candy", new Vector2(maingame.topLeftOfScreen.X + 10,maingame.topLeftOfScreen.Y+ 62), Color.IndianRed, 0f, new Vector2(0, 0), 1f, SpriteEffects.None, 0.1f);
        }
        public void LoadContent()
        {
            textFont = maingame.Content.Load<SpriteFont>("fonts/font");
        }
    }
}
